encapsulate

fun <O> encapsulate(value: Any, callback: <ERROR CLASS><T>.(T) -> O): O?